<?php foreach ($frontpage->result() as $f): ?>
    <div class="home-column">
        <div class="home-row">
            <?php if (strlen(trim($f->link1)) > 0): ?>
                <a href="<?php echo $f->link1; ?>" target="_blank">
                <?php endif; ?>
                <div>
                    <img src="<?php echo base_url(); ?>photo/frontpage/<?php echo $f->img1; ?>"/>
                </div>
                <?php if ($f->type == 0): ?>
                    <?php if (strlen(trim($f->text1)) > 0): ?>
                        <div class="home-caption">
                            <p class="home-caption-title">
                                <?php echo $f->name; ?>
                            </p>
                            <p>
                                <?php echo $f->text1; ?>
                            </p>
                        </div>
                    <?php endif; ?>
                <?php endif; ?>
                <?php if (strlen(trim($f->link1)) > 0): ?>
                </a>
            <?php endif; ?>
        </div>
        <?php if ($f->type >= 1): ?>
            <div class="home-row">
                <?php if (strlen(trim($f->link2)) > 0): ?>
                    <a href="<?php echo $f->link2; ?>" target="_blank">
                    <?php endif; ?>
                    <img src="<?php echo base_url(); ?>photo/frontpage/<?php echo $f->img2; ?>"/>
                    <?php if (strlen(trim($f->link2)) > 0): ?>
                    </a>
                <?php endif; ?>
            </div>
        <?php endif; ?>
        <?php if ($f->type == 2): ?>
            <?php if (strlen(trim($f->link3)) > 0): ?>
                <a href="<?php echo $f->link3; ?>" target="_blank">
                <?php endif; ?>
                <img src="<?php echo base_url(); ?>photo/frontpage/<?php echo $f->img3; ?>"/>
                <?php if (strlen(trim($f->link3)) > 0): ?>
                </a>
            <?php endif; ?>
        </div>
    <?php endif; ?>
    </div>
<?php endforeach; ?>